﻿<UserControl x:Class="CoverFlow.Client.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:app="clr-namespace:CoverFlow.Client.Converters"
             xmlns:c="clr-namespace:DC.ControlLibrary;assembly=DC.ControlLibrary"
             mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <UserControl.Resources>
        <app:UrlConverter x:Key="UrlConverter"/>
        <app:TitleConverter x:Key="TitleConverter" />
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="Black">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="500" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="1">
                <Grid>
                    <Grid.OpacityMask>
                        <LinearGradientBrush EndPoint="0,.5" StartPoint="1,.5">
                            <GradientStop Color="#00000000" Offset="1"/>
                            <GradientStop Color="#FF000000" Offset="0.8"/>
                            <GradientStop Color="#FE000000" Offset="0.2"/>
                            <GradientStop Color="#00000000" Offset="0"/>
                        </LinearGradientBrush>
                    </Grid.OpacityMask>
                    <c:CoverFlowControl x:Name="flowControl" Background="Black" ItemsSource="{Binding Trailers}" SelectedItem="{Binding SelectedTrailer, Mode=TwoWay}" CacheMode="BitmapCache" >
                        <c:CoverFlowControl.ItemTemplate>
                            <DataTemplate>
                                <Border CornerRadius="10" BorderBrush="#99444444" BorderThickness="2" Background="{Binding Poster.ExtraLarge, Converter={StaticResource UrlConverter}}" >
                                    <Image Source="{Binding  Poster.ExtraLarge}" Opacity="0"  >
                                    </Image>
                                </Border>
                            </DataTemplate>
                        </c:CoverFlowControl.ItemTemplate>
                    </c:CoverFlowControl>
                </Grid>
            </Grid>

            <TextBlock Text="{Binding SelectedItem, ElementName=flowControl, Converter={StaticResource TitleConverter}}"  Grid.Row="2" Margin="5" HorizontalAlignment="Center" Foreground="White" FontSize="24"/>

        </Grid>
        
    </Grid>
</UserControl>
